<template>
  <sc-table-select
    placeholder="---请选择---"
    ref="tableselect"
    v-model="defaultOrgCode"
    style="width: 300px"
    :pageId="pageId"
    :userCode="userCode"
    :purviewType="purviewType"
    :attrList="attrList"
    :valueList="valueList"
    :queryList="queryList"
    :orderList="orderList"
    :table-width="640"
    collapse-tags
    collapse-tags-tooltip
    :props="props"
    :selectKeyValue="selectKeyValue"
    @change="change"
  >
    <template #header="{}">
      <el-form :inline="true">
        <el-row :gutter="5"
          ><el-col :span="5">
            <el-input
              v-model="queryList.Code"
              placeholder="请输入编码"
              style="width: 125px"
            ></el-input></el-col
          ><el-col :span="5">
            <el-input
              v-model="queryList.Name"
              placeholder="请输入名称"
              style="width: 125px"
            ></el-input> </el-col
          ><el-col :span="5"
            ><el-select
              v-model="queryList.TypeCode"
              placeholder="请选择类型"
              style="width: 125px"
              clearable
              :teleported="false"
            >
              <el-option label="---请选择---" value=""></el-option>
              <el-option label="直营店" value="01"></el-option>
              <el-option
                label="加盟店"
                value="02"
              ></el-option> </el-select></el-col
          ><el-col :span="5">
            <el-select
              v-model="queryList.State"
              placeholder="请选择状态"
              clearable
              :teleported="false"
              style="width: 125px"
            >
              <el-option label="---请选择状态---" value="" />
              <el-option label="禁用" value="0" />
              <el-option label="启用" value="1" /> </el-select></el-col
          ><el-col :span="4">
            <el-button type="primary" @click="$refs.tableselect.getData()"
              >查询</el-button
            ></el-col
          ></el-row
        >
      </el-form>
    </template>
    <el-table-column
      prop="OrgCode"
      label="机构编码"
      width="100"
    ></el-table-column>
    <el-table-column
      prop="OrgName"
      label="机构名称"
      width="150"
    ></el-table-column>
    <el-table-column
      prop="ParentName"
      label="父级"
      width="150"
    ></el-table-column>
    <el-table-column
      prop="OrgTypeName"
      label="类型"
      width="120"
    ></el-table-column>
    <el-table-column prop="State" label="状态" width="100"></el-table-column>
  </sc-table-select>
</template>

<script>
export default {
  name: "orgselect",
  data() {
    return {
      attrList: {
        Name: "Organize",
        UseDistinct: false,
        OrgCode: "",
        UseBackUp: false,
        UseGroup: false,
      },
      valueList: {
        Code: "OrgCode",
        Name: "OrgName",
        ParentName: "ParentName",
        OrgTypeName: "OrgTypeName",
        State: "State",
      },
      queryList: {
        Code: "",
        Name: "",
        OrgTypeCode: "",
        Visible:"1",
        // InLocal:"0",
        State: "",
        pageId: this.pageId,
        userCode: this.userCode,
        purviewType: "super",
      },
      //apiObj: this.$API.demo.page,
      params: {
        name: "demoName",
      },
      defaultOrgCode: "",
      props: {
        label: "OrgName",
        value: "OrgCode",
        keyword: "keyword",
        pageId: { type: String, default: "" },
        userCode: { type: String, default: "super" },
        purviewType: { type: String, default: "super" },
        selectKeyValue: { type: String, default: "Code" },
      },
      formatType(row, column) {
        // eslint-disable-next-line no-debugger
        ////debugger;
        console.log(row, column);
        switch (row.TypeCode) {
          case "01":
            return "直营店";
          case "02":
            return "加盟店";
          default:
            return "";
        }
      },
    };
  },
  computed: {},
  mounted() {},
  methods: {
    //值变化
    change(val) {
      this.$message("change事件,返回详情查看控制台1");
      // eslint-disable-next-line no-debugger
      //debugger;
      console.log(val);
      this.defaultOrgCode = val.OrgCode;
    },
  },
};
</script>

<style scoped></style>
